<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">

    <input type="text" v-model="val"><button @click="send">发送</button>
    <audio :src="voice" autoplay controls></audio>
  </div>
  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.14/vue.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
  <script>
    const an = new Vue({
      el: '#app',
      data: {
        val: '你好',
        voice: 'https://dds.dui.ai/runtime/v1/synthesize?voiceId=qianranfa&speed=0.8&volume=100&audioType=wav&text=%E5%97%AF%E5%97%AF%E5%97%AF%EF%BC%8C%E5%A5%BD%E5%A5%BD%E5%A5%BD'
      },
      methods: {
       async  send() {
        const res = await axios({
            url: 'http://ajax-api.itheima.net/api/robot?val=' + this.val,
            
          })
          const res2 = await axios({
            url: 'http://ajax-base-api-t.itheima.net/api/synthesize?text=' + res.data.data.info.text
          })
          console.log(res2.data.voiceUrl, 2222);
          this.voice = res2.data.voiceUrl
        }
      }
    })
  </script>
</body>

</html>